package com.foreknow.demo7;

public class Person {
    //属性(变量)
    String name;
    int age;
    String school;

    //行为(方法)
    public void eat() {
        System.out.println("eat......");
    }

    public void study() {
        System.out.println("study......");
    }

    public static void main(String[] args) {
        //1. 创建一个Person类型对象
        Person p1 = new Person();
        //2. 调用p1对象中的属性和方法
        p1.name = "fender";
        System.out.println(p1.name);
        p1.age = 20;
        System.out.println(p1.age);
        p1.school = "neu";
        System.out.println(p1.school);
        p1.eat();
        p1.study();

        //3.创建一个新的对象并调用对象的属性和方法
        Person p2 = new Person();
        p2.name = "gibson";
        p2.age = 30;
        p2.school = "xxx";
        System.out.println(p2.name);
        System.out.println(p2.age);
        System.out.println(p2.school);
        p2.eat();
        p2.study();



    }
}

